import axios from 'axios'
import nprogress  from 'nprogress'
import 'nprogress/nprogress.css'

//创建一个axios实例
const request =axios.create({
    timeout: 5000,
})
//请求拦截器
request.interceptors.request.use((config)=>{
    nprogress.start()
    return config
})
//相应拦截器
request.interceptors.response.use((res)=>{
   
    nprogress.done()
    return res.data
},(err)=>{
    nprogress.done()
    return new Promise(()=>{})
    }
)
export default request